package com.zhongkun.datahome.service.constant;

import com.zhongkun.datahome.common.utils.StringUtils;

import java.util.List;

/**
 * @Author: huangjie
 * @Date: 2025/4/15 14:31
 * @Desc
 */
public enum TaskTypeEnum {
    FEEDBACK("feedback", "问题反馈"),
    COMMON("common", "通用任务"),
    ACCEPTANCE("acceptance", "验收"),
    RECTIFICATION("rectification", "整改"),
    NOTICE("notice", "通知业主");

    private String type;
    private String desc;

    TaskTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static String getTaskTypeName(String taskType) {
        for (TaskTypeEnum taskTypeEnum : TaskTypeEnum.values()) {
            if (StringUtils.equals(taskTypeEnum.getType(), taskType)) {
                return taskTypeEnum.getDesc();
            }
        }
        return "";
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public boolean is(String taskType) {
        return StringUtils.equals(this.getType(), taskType);
    }

    public static List<String> customerStartTaskType() {
        return List.of(FEEDBACK.getType());
    }

    public static List<String> customerReceiveTaskType() {
        return List.of(NOTICE.getType());
    }

    public static List<String> employeeStartTaskType() {
        return List.of(NOTICE.getType(), ACCEPTANCE.getType(), RECTIFICATION.getType(), COMMON.getType());
    }

    public static List<String> employeeReceiveTaskType() {
        return List.of(ACCEPTANCE.getType(), RECTIFICATION.getType(), COMMON.getType(), FEEDBACK.getType());
    }

    public static List<String> getReceiveTaskType(boolean employeeFlag) {
        return employeeFlag ? employeeReceiveTaskType() : customerReceiveTaskType();
    }

    public static List<String> getStartTaskType(boolean employeeFlag) {
        return employeeFlag ? employeeStartTaskType() : customerStartTaskType();
    }
}
